package com.baihan.angus.app.game.busshow.ui.home.follow;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;

import com.baihan.angus.app.game.basic.base.view_model.BaseViewModel;
import com.baihan.angus.app.game.basic.utils.Tooast;
import com.baihan.angus.app.game.basic.utils.net.ApiObserver;
import com.baihan.angus.app.game.common.bean.response.BbsResponse;
import com.baihan.angus.app.game.common.data_center.remote.RemoteDataMng;

import java.util.Map;

public class FollowVM extends BaseViewModel {

    public FollowVM(@NonNull Application application) {
        super(application);
    }

    public MutableLiveData<BbsResponse.DataX> mldBbs = new MutableLiveData<>();

    public void getBbsList(Map<String, Object> pMap) {
        showLoading("getBbsList");
        RemoteDataMng.getInstance().getBbsList(pMap, mLifecycleProvider.bindToLifecycle(), new ApiObserver<BbsResponse>() {
            @Override
            public void onSuccess(BbsResponse bbsResponse) {
                hideLoading("getBbsList");
                mldBbs.setValue(bbsResponse.getData());
            }

            @Override
            public void onFailed(int code, String msg) {
                hideLoading("getBbsList");
                mldBbs.setValue(null);
                Tooast.normalInfo(msg);
            }
        });
    }
}
